package com.junsi.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.junsi.bean.Information;
import com.junsi.mapper.InformationMapper;
import com.junsi.service.InformationService;

/**   
  * @文件名: InformationServiceImpl.java 
  * @包名: com.junsi.service.impl 
  * @类名: InformationServiceImpl   
  * @时间: 2017年7月19日 上午9:09:43 2017
  * @作者: 
  * @类功能描述:TODO 请简要描述你的类   
  */
@Service
@Transactional(rollbackFor = Exception.class)
public class InformationServiceImpl implements InformationService {
	
	@Autowired
	private InformationMapper informationMapper;

	@Override
	/**
	 * 查询所有
	 */
	public List<Information> findByAll() {
		List<Information> list = informationMapper.findByAll();
		return list;
	}

	@Override
	/**
	 * 根据id查询
	 */
	public Information findById(Integer id) {
		Information information = informationMapper.findById(id);
		return information;
	}

	@Override
	/**
	 * 根据id删除
	 */
	public boolean deleteById(Integer id) {
		int i = informationMapper.deleteById(id);
		if(i == 1){
			return true;
		}
		return false;
	}

	@Override
	/**
	 * 新增
	 */
	public boolean save(Information information) {
		int i = informationMapper.save(information);
		if(i == 1){
			return true;
		}
		return false;
	}

	@Override
	/**
	 * 修改
	 */
	public boolean update(Information information) {
		int i = informationMapper.update(information);
		if(i == 1){
			return true;
		}
		return false;
	}

}
